<template>
  <div>
     <!-- <CollectPage2List :collect-id="666" :userId="666" :collectName="666"></CollectPage2List> -->
     <p>新建收藏夹</p>
     <van-field
        v-model="collectName"
        rows="1"
        autosize
        label="收藏夹名："
        type="textarea"
        placeholder="请输入收藏夹名字"
        
      />
      <van-button icon="http://rul4y8e5f.hn-bkt.clouddn.com/%E7%A1%AE%E8%AE%A4.png" round @click="newCollect()">确定</van-button>
 </div>
</template>

<script>
import CollectAPI from '@/api/CollectAPI' 
export default {
  name: "CreateCollect",
  data() {
    return {
      collectName: ''
    }
  },
  methods: {
    newCollect(){
      var result = CollectAPI.CreateCollect(this.collectName)
        // 获取返回结果
       result.then((val) => {
        console.log(val);
        if (val.success) {
          this.$toast("创建成功！");
          // 刷新
          // this.$router.go(0)
          // this.$router.push("/userInfo")
        }
        else {
         console.log(val.errorMsg);
         this.$toast(val.errorMsg);
             }
      });
    },
  },
}
</script>

<style>

</style>